﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Microsoft.Bing
{
    /// <summary>
    /// Implements a simple (two digit) version type. This class is used to identify the Microsoft Bing API version.
    /// </summary>
    public class SimpleVersion
    {
        /// <summary>
        /// Instantiates a <see cref="SimpleVersion"/> instance.
        /// </summary>
        public SimpleVersion()
        {

        }

        /// <summary>
        /// Instantiates a <see cref="SimpleVersion"/> instance.
        /// </summary>
        /// <param name="major">The major version</param>
        /// <param name="minor">The minor version</param>
        public SimpleVersion(uint major, uint minor)
        {
            this.Major = major;
            this.Minor = minor;
        }

        private uint _Major;
        private uint _Minor;

        /// <summary>
        /// Gets/Sets the Major version for the <see cref="SimpleVersion"/>.
        /// </summary>
        public uint Major
        {
            get { return _Major; }
            set { _Major = Math.Max(1, value); }
        }

        /// <summary>
        /// Gets/Sets the Minor version for the <see cref="SimpleVersion"/>.
        /// </summary>
        public uint Minor
        {
            get { return _Minor; }
            set { _Minor = value; }
        }

        /// <summary>
        /// (Override) Returns a string representation of the <see cref="SimpleVersion"/>.
        /// </summary>
        public override string ToString()
        {
            return String.Format("{0}.{1}", this.Major, this.Minor);
        }
    }
}
